<template>
  <div>
    <el-button :disabled="data.id === 1" size="mini" type="success" @click="to(data.id)">编辑</el-button>
    <!-- <el-tooltip content="编辑用户" placement="top">
      <svg-icon class-name="edit-icon" icon-class="edit" @click.native="to(data.id)"/>
    </el-tooltip> -->
    <eForm ref="form" :roles="roles" :sup_this="sup_this" :is-add="false"/>
  </div>
</template>
<script>
import eForm from './form'
export default {
  components: { eForm },
  props: {
    roles: {
      type: Array,
      required: true
    },
    data: {
      type: Object,
      required: true
    },
    // index.vue 的this 可用于刷新数据
    sup_this: {
      type: Object,
      required: true
    }
  },
  methods: {
    to(id) {
      const _this = this.$refs.form
      _this.roleIds = []
      _this.form = { id: this.data.id, name: this.data.name, short: this.data.short, bg_img: this.data.bg_img,
       font_size: this.data.font_size, font_color: this.data.font_color, is_font_weight: this.data.is_font_weight.toString()}
      _this.dialog = true
    }
  }
}
</script>

<style scoped>
  div{display: inline-block;margin-right: 3px;}
  .edit-icon {
  width: 1.5em;
  height: 1.5em
}
</style>
